const app = getApp();
Page({
  data: {
    StatusBar: app.globalData.StatusBar,
    CustomBar: app.globalData.CustomBar,
    iconList: [{
        icon: 'cloud://tfjkp-0ge80vu9ea710148.7466-tfjkp-0ge80vu9ea710148-1305195523/myjkp/checkinlisticon/paihangbang.png',
        name: '排行榜',
        isAvailable: false // 未开发完，显示“敬请期待~”
      },
      {
        icon: 'cloud://tfjkp-0ge80vu9ea710148.7466-tfjkp-0ge80vu9ea710148-1305195523/myjkp/checkinlisticon/nengliang.png',
        name: '绩点能量',
        isAvailable: false // 未开发完，显示“敬请期待~”
      },
      {
        icon: 'cloud://tfjkp-0ge80vu9ea710148.7466-tfjkp-0ge80vu9ea710148-1305195523/myjkp/checkinlisticon/jilu.png',
        name: '最近记录',
        isAvailable: false // 未开发完，显示“敬请期待~”
      },
      {
        icon: 'cloud://tfjkp-0ge80vu9ea710148.7466-tfjkp-0ge80vu9ea710148-1305195523/myjkp/checkinlisticon/huodongliebiao.png',
        name: '活动列表',
        isAvailable: false // 未开发完，显示“敬请期待~”
      },
      {
        icon: 'cloud://tfjkp-0ge80vu9ea710148.7466-tfjkp-0ge80vu9ea710148-1305195523/myjkp/checkinlisticon/jifenshangcheng.png',
        name: '积分商城',
        isAvailable: false // 未开发完，显示“敬请期待~”
      },
      {
        icon: 'cloud://tfjkp-0ge80vu9ea710148.7466-tfjkp-0ge80vu9ea710148-1305195523/myjkp/checkinlisticon/weizhi.png',
        name: '公园地图',
        isAvailable: false // 未开发完，显示“敬请期待~”
      },
      {
        icon: 'cloud://tfjkp-0ge80vu9ea710148.7466-tfjkp-0ge80vu9ea710148-1305195523/myjkp/checkinlisticon/zhaocesuo.png',
        name: '找厕所',
        isAvailable: false // 未开发完，显示“敬请期待~”
      },
      {
        icon: 'cloud://tfjkp-0ge80vu9ea710148.7466-tfjkp-0ge80vu9ea710148-1305195523/myjkp/checkinlisticon/zhaotingchechang.png',
        name: '找停车场',
        isAvailable: false // 未开发完，显示“敬请期待~”
      }
    ],
    skin: false
  },
  showModal(e) {
    this.setData({
      modalName: e.currentTarget.dataset.target
    })
  },
  hideModal(e) {
    this.setData({
      modalName: null
    })
  },
  gridchange: function (e) {
    this.setData({
      gridCol: e.detail.value
    });
  },
  gridswitch: function (e) {
    this.setData({
      gridBorder: e.detail.value
    });
  },
  menuBorder: function (e) {
    this.setData({
      menuBorder: e.detail.value
    });
  },
  menuArrow: function (e) {
    this.setData({
      menuArrow: e.detail.value
    });
  },
  menuCard: function (e) {
    this.setData({
      menuCard: e.detail.value
    });
  },


  // ListTouch触摸开始
  ListTouchStart(e) {
    this.setData({
      ListTouchStart: e.touches[0].pageX
    })
  },

  // ListTouch计算方向
  ListTouchMove(e) {
    this.setData({
      ListTouchDirection: e.touches[0].pageX - this.data.ListTouchStart > 0 ? 'right' : 'left'
    })
  },

  // ListTouch计算滚动
  ListTouchEnd(e) {
    if (this.data.ListTouchDirection == 'left') {
      this.setData({
        modalName: e.currentTarget.dataset.target
      })
    } else {
      this.setData({
        modalName: null
      })
    }
    this.setData({
      ListTouchDirection: null
    })
  },
})